package com.aiyan.edu.service.auth.center;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.http.client.OkHttp3ClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;

/**
 * @author: zqzhou
 * @create: 2019/11/21 15:53
 **/
@EnableEurekaClient
@EnableFeignClients
@SpringBootApplication
@EntityScan("com.aiyan.edu.framework.domain.ucenter")
@ComponentScan(basePackages = {"com.aiyan.edu.api"})
@ComponentScan(basePackages = {"com.aiyan.edu.framework"})
@ComponentScan(basePackages = {"com.aiyan.edu.service.auth.center"})
public class AuthCenterServiceApplication {
    public static void main(String[] args) {
        SpringApplication.run(AuthCenterServiceApplication.class, args);
    }

    @Bean
    public RestTemplate restTemplate() {
        RestTemplate restTemplate = new RestTemplateBuilder()
                .build();

        restTemplate.setRequestFactory(new OkHttp3ClientHttpRequestFactory());

        return restTemplate;
    }
}
